<?php
$allAttributes = getAllAttributes();
	$result = "<table id=\"example1\" align=\"center\" class=\"tablecss\"><thead><tr><th></th><th></th>";
	if (count($_GET) > 0) {
		if(!isset($_GET['date1']) || !$_GET['date1']){
			return 'Unable to make table: no start date specified';
		}
		if(!isset($_GET['date2']) || !$_GET['date2']){
			return 'Unable to make table: no end date specified';
		}
		$startDate = $_GET['date1'];
		$endDate = $_GET['date2'];
		if(isset($_GET['crops'])) $crops = explode(";",$_GET["crops"]);
		else $crops = array();
		$cropNames = $crops;
		$crops = getCropIds($crops);

		$nameAssoc = array();
		foreach($cropNames as $cropName){
			$nameAssoc[$cropName] = getCropId($cropName);
		}


		$attrs = array();

		foreach($_GET as $name => $value) {
			if(array_key_exists($name, $allAttributes)){
				$attrs[] = $name;
			}
		}
		if(count($attrs) == 0){
			return "Unable to make table: no attributes to display specified";
		}
		$startYear = substr($startDate,6,4);
		$endYear = substr($endDate,6,4);
		
		$startDate = $startYear . "-" . substr($startDate,0,2) . "-" . substr($startDate,3,2);
		$endDate = $endYear . "-" . substr($endDate,0,2) . "-" . substr($endDate,3,2);

		$rows = array();
?>